package model;

import java.util.Collection;
import java.util.HashMap;

public class StateSet {

	private final HashMap<Integer,State> states;
	
	public Collection<State> getStateCollection(){
		return this.states.values();
	}
	
	/**
	 * Factory method for creating an empty StateSet.
	 * @return
	 */
	public static StateSet create(){
		return new StateSet();
	}
	
	/**
	 * Constructor of StateSet.
	 */
	private StateSet(){
		this.states = new HashMap<Integer, State>();
	}
	
	/**
	 * Provides whether the provided {@link State} is in this StateSet.
	 * @param s is the {@link State} to search for.
	 * @return true if this StateSet contains the provided {@link State}. False if not.
	 */
	public boolean contains(final State s){
		return this.states.containsKey(s.hashCode());
	}

	/**
	 * Adds a {@link State} to this StateSet.
	 * @param state is the {@link State} to add.
	 */
	public void add(final State state) {
		this.states.put(state.hashCode(), state);
	}

}
